exports.main = async (event, context) => {
	const db = uniCloud.database();
	const {
		i,
		MAX_LIMIT,
		novel,
		command,
		name,
		age
	} = event;
	let res;

	switch (command) {
		case 0:
			res = await db.collection("novelpersonlist")
				.where({
					novel: novel
				})
				.orderBy("birth", "asc")
				.skip(i * MAX_LIMIT)
				.limit(MAX_LIMIT)
				.get();
			break;
		case 1:
			res = await db.collection("novelpersonlist")
				.where({
					novel: novel,
					name: name
				})
				.orderBy("birth", "asc")
				.get();
			break;
		case 2:
			// 添加你的操作逻辑
			res = await db.collection("novelpersonlist")
				.where({
					birthyear: db.command.lte(age),
					dieyear: db.command.gte(age)
				})
				.orderBy("birth", "asc")
				.get();
			break;
		case 3:
			// 添加你的操作逻辑
			res = await db.collection("novelpersonlist")
				.where({
					birthyear: db.command.lte(age),
					dieyear: db.command.gte(age)
				})
				.orderBy("birth", "asc")
				.get();
			break;
		default:
			// 处理其他情况
			break;
	}

	return res;
};